<?php include "../public/header.php";?>
<?php include "../public/header_edit.php";?>
<style>
    #chongzhi{border-radius: 5px;width: 120px;background-color: #FFFFFF;color: #2272eb;border: 1px solid #2272eb;margin-right: 10px}
    #xiaoyan{border-radius: 5px;width: 120px;}
    #botbut{text-align: center;margin: 50px}
</style>

<body id="optPage">
<form class="layui-form layui-form-pane" id="commentForm">
    <div class="page-title">
        <div class="page-title-con"><span>项目来款认领</span><div class="move_title"></div>
            <div class="page-title-opt-list">
                <button type="button" id="subturn" class="layui-btn layui-btn-sm btn-dark marginr5 layui-hide" lay-submit="" lay-filter="add">提交</button>
                <span id="page-close" class="page-close" onclick="layer_close()">×</span>
            </div>
        </div>
    </div>
    <div class="main-container">

        <div class="block-generic">


            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="edittits"><span>基本信息</span></div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6" style="margin-right: 25%;float: right">
                        <label class="layui-form-label" style="width: 140px"><text>*</text>选择认领来款信息</label>
                        <div class="layui-input-block" style="margin-left: 140px!important;">
                            <input type="text" readonly name="daiid" class="layui-input daiid" onclick="openPage('../public/choose_income_engin_dai.php?dom=daiid&page=dai','80%','80%')">
                            <div class="choose_div" id="daiid" key="1"></div>
                            <span class="choose_one" onclick="openPage('../public/choose_income_engin_dai.php?dom=daiid&page=dai','80%','80%')"><i class="layui-icon layui-icon-search"></i></span>
                        </div>
                    </div>
                </div>
            </div>
            <span id="cmval" class="layui-hide"></span>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6" style="margin-right: 25%;float: right">
                        <label class="layui-form-label" style="width: 140px"><text>*</text>到账金额(元)</label>
                        <div class="layui-input-block" style="margin-left: 140px!important;">
                            <input type="text" name="money" id="money" placeholder="请输入" autocomplete="off" class="layui-input moneyinput">
                        </div>
                    </div>
                </div>
            </div>

            <div class="page-title-opt-list" id="botbut">
                <button type="button" id="chongzhi" class="layui-btn layui-btn-sm" lay-submit="" lay-filter="reset">重置</button>
                <button type="button" id="xiaoyan"  class="layui-btn layui-btn-sm btn-dark marginr5" lay-submit="" lay-filter="add">提交</button>
            </div>
        </div>

    </div>
</form>
<script>
    $("#commentForm").validate({
        rules: {
            money: {required: true},
        },
        messages:{
            money: {required: "请输入"},
        }
    });

    layui.use(['laytp', 'form'], function() {
        var form = layui.form, layer = layui.layer;
        render_input_attr();




        form.on('submit(reset)', function(data){
            $("#daiid").html('');
            $("#money").val('');
            return false;
        });

        form.on('submit(add)', function(data){
            var validRes = $("#commentForm").valid();
            data.field.daiid = get_choose_val('daiid');
            formValid('daiid');
            if(data.field.daiid == undefined || !data.field.daiid){
                validRes = false;
            }
            if(!validRes){return false;}
            data = parseMoney(data);

            var cmval = parseFloat($("#cmval").text());
            if(parseFloat(data.field.money) == cmval){
                parent.auth_but_func_ren(data.field.daiid);
            }else{
                facade.error("校验失败!"); return false;
            }
            return false;
        });

    });

</script>
</body>
</html>
